package com.example.fraud;

import com.example.client.FraudReviewResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("api/v1/fraud-check")
public record FraudReviewController(FraudReviewService fraudReviewService) {

    @GetMapping("{email}")
    public FraudReviewResponse isFraudster(@PathVariable("email") String customerEmail) {
        log.info("收到欺诈检查请求 for email: {}", customerEmail);
        Boolean isFraudulent = fraudReviewService.isFraudulentCustomer(customerEmail);
        return new FraudReviewResponse(isFraudulent);
    }
}